package com.heima.wemedia.feign;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.heima.apis.wemedia.IWmSensitiveClient;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.admin.dtos.SensitiveDto;
import com.heima.model.wemedia.pojos.WmSensitive;
import com.heima.wemedia.service.WmSensitiveService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author Xiao
 * @version 1.0
 * @description
 * @date 2021/11/29
 */
@RestController
@RequestMapping("/api/v1/sensitive")
public class WmSensitiveClient implements IWmSensitiveClient {
    @Autowired
    private WmSensitiveService wmSensitiveService;

    /**
     * 敏感词列表
     * @param dto
     * @return
     */
    @PostMapping("/list")
    public Page getList(@RequestBody SensitiveDto dto) {
        return wmSensitiveService.getList(dto);
    }

    /**
     * 敏感词删除
     * @param id
     * @return
     */
    @Override
    @DeleteMapping("/del/{id}")
    public ResponseResult delSensitive(@PathVariable Integer id) {
        return wmSensitiveService.delSensitive(id);
    }

    /**
     * 添加敏感词
     * @param wmSensitive
     * @return
     */
    @Override
    @PostMapping("/save")
    public ResponseResult saveSensitive(@RequestBody WmSensitive wmSensitive) {
        return wmSensitiveService.saveSensitive(wmSensitive);
    }

    /**
     * 修改敏感词
     * @param wmSensitive
     * @return
     */
    @Override
    @PostMapping("/update")
    public ResponseResult updateSensitive(@RequestBody WmSensitive wmSensitive) {
        return wmSensitiveService.updateSensitive(wmSensitive);
    }
}
